SELinux System Administration Third Edition by Sven Vermeulen
Author:Sven Vermeulen
Language: eng
Format: mobi, epub
Publisher: Packt Publishing Ltd
Published: 2020-11-03T16:00:00+00:00
Using transient services
systemd can also be used to launch applications as if they are services and have them under systemd's control. Such applications are called transient services as they lack the unit files that generally declare how systemd should behave.
Transient services are launched through the systemd-run application. To show this, let's create a simple Python script (one that calculates Pi up to 10,000 digits):
from decimal import Decimal, getcontext
getcontext().prec=10000
with open('/tmp/pi.out', 'w') as f:
print(sum(1/Decimal(16)**k * (
Decimal(4)/(8*k+1)-
Decimal(2)/(8*k+4)-
Decimal(1)/(8*k+5)-
Decimal(1)/(8*k+6)) for k in range(10000)), file=f)
As this takes some time, we can opt to run this Python script under systemd's control:
# systemd-run python3.6 /tmp/pi.py
Running as unit: run-rf9ce45c...f343.service
As transient services do not have unit files to manage, changing the SELinux context must be accomplished through the command line as well. Of course, this is only needed if the standard domain transitions defined in the policy do not result in the wanted behavior:
# systemd-run -p SELinuxContext=guest_u:guest_r:guest_t:s0 python3.6 /tmp/pi.py
The systemd-run application supports this through the --property (or -p) option, through which unit file properties can be added. In the previous example, we use this option to run the script in the guest_t domain using the SELinuxContext property, similar to how we would define this in the unit file itself.
Download
SELinux System Administration Third Edition by Sven Vermeulen.epub
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7808)
Grails in Action by Glen Smith Peter Ledbrook(7719)
Azure Containers Explained by Wesley Haakman & Richard Hooper(6826)
Configuring Windows Server Hybrid Advanced Services Exam Ref AZ-801 by Chris Gill(6824)
Running Windows Containers on AWS by Marcio Morales(6347)
Kotlin in Action by Dmitry Jemerov(5090)
Microsoft 365 Identity and Services Exam Guide MS-100 by Aaron Guilmette(5063)
Combating Crime on the Dark Web by Nearchos Nearchou(4637)
Microsoft Cybersecurity Architect Exam Ref SC-100 by Dwayne Natwick(4597)
Management Strategies for the Cloud Revolution: How Cloud Computing Is Transforming Business and Why You Can't Afford to Be Left Behind by Charles Babcock(4437)
The Ruby Workshop by Akshat Paul Peter Philips Dániel Szabó and Cheyne Wallace(4327)
The Age of Surveillance Capitalism by Shoshana Zuboff(3979)
Python for Security and Networking - Third Edition by José Manuel Ortega(3888)
The Ultimate Docker Container Book by Schenker Gabriel N.;(3547)
Learn Windows PowerShell in a Month of Lunches by Don Jones(3528)
Learn Wireshark by Lisa Bock(3515)
Mastering Python for Networking and Security by José Manuel Ortega(3376)
Mastering Azure Security by Mustafa Toroman and Tom Janetscheck(3355)
Blockchain Basics by Daniel Drescher(3324)
